---
# tasks file for osbs-client

- name: install osbs-client package
  action: "{{ ansible_pkg_mgr }} name=osbs-client state=present"
  tags:
  - osbs-client

- name: apply osbs-client templated config
  template: src=osbs.conf.j2 dest={{ osbs_client_conf_path }} mode=0640
  tags:
  - osbs-client

- name: Create custom OSBS input directory
  file:
    path: "/etc/osbs/input/"
    state: directory
  tags:
  - osbs-client
  when: env == 'production'

# This overrides defaults which are set in
# https://github.com/projectatomic/osbs-client/blob/master/inputs/prod_inner.json
- name: Upload OSBS Site Customizations plugin conf
  copy:
    src: "osbs-site-customize.json"
    dest: "/etc/osbs/input/prod_customize.json"
    mode: 0400
  tags:
  - osbs-client
  when: env == 'production'

- name: Symlink in OSBS input configs provided by package
  file:
    src: "/usr/share/osbs/{{item}}.json"
    dest: "/etc/osbs/input/{{item}}.json"
    state: link
  with_items:
    - "prod"
    - "prod_inner"
  tags:
  - osbs-client
  when: env == 'production'

- name: We do not want orchestrator.json in production
  file: name=/etc/osbs/input/orchestrator.json state=absent
  tags:
  - osbs-client
  when: env == 'production'
